home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
m2
/
m2_part1.lha
/
modula
/
README
< prev
Wrap
Text File
|
1994-07-30
|
14KB
|
354 lines
================================================================================
Amiga Turbo Modula-2 V1.0d (27/6/94)
Amiga Turbo Modula-2 (c) Copyright 1994 by Amritpal Mann, All Rights Reserved
================================================================================
This is a freely distributable demonstration version of a (PIM4) Modula-2
development system. Amiga Turbo Modula-2 consists of:
A compiler(M2C), a link utility(M2L), an error lister(M2E),
and a program builder(M2B).
Interface modules for V40 of the AmigaOS & corresponding linker library,
ANSI C standard library definitions as well as those from PIM.
The compiler reads source code in a single pass which means fast
compilation. Internally however it performs several passes over each
procedures statement sequence in order to generate fast and compact code.
Typically, generated code is 25% smaller & 75% faster than the ($200)
commercial Amiga Modula-2 compiler used for the initial bootstraps.
Turbo does not have its own linker, instead it requires a 'C' compiler
front-end to link generated code.
The unregistered freeware version of Matt Dillon's excellent C system,
DICE, has been included and contains 2 necessary programs, DCC & DLINK,
as well as vital startup code(c.o) and support libraries(c.lib,auto.lib,x.o)
Note that Turbo does NOT produce 'C' as intermediate output, it just uses
DCC to link and add startup code the machine code it generates.
You do not need to know how to use DICE in order to generate M2 executables,
M2L calls DCC for you , all you need do is extract DICE (see below).
The reason for using DICE instead of say BLINK, are that DICE has excellent
support for generating residentable programs, also the standard C library
supplied with DICE becomes automatically available and finally
(for those of us who have slow(er) amigas) DLINK runs fast!
The unregistered freeware version of DICE may be redistributed unmodified
& only in whole. This also applies to this demo version of Turbo Modula-2.
The minimum required setup in order to use Turbo is 1MB of memory
and 1.2(V33) workbench & 2 disk drives. However I recommend
that you should have at least 1MB of available(free) memory and a hard disk.
Also M2B will not propagate ^C break detection to M2C & M2L unless you're
running under V36 or above. To use M2B you really need a real-time clock or
otherwise set the time at bootup or instead use M2C & M2L directly.
Demo version limitations
========================
In order to encourage you to purchase the full version of Turbo M2 the
compiler will refuse to compile modules (not programs) that translate to
more than 2K of machine code (that's about 250 lines of code) and contain
more than 4K of global variables. Only a small selection of library modules
are provided.
Dice Extraction
===============
The file dice/dice.lha contains the DICE system.In order to save your
hard disk space, the dice/M2EXTRACT script will extract the files that we
are interested in (as well as the DICE copyright messages etc):
>cd dice
>execute M2EXTRACT
You can of course extract the entire archive if you prefer.
If you already have DICE installed on your system, and are therefore not
extracting it again, you should make the apropriate modifications to the
INSTALL script...
Directory Organisation
======================
The two m2.lha parts should have unarchived a root directory named 'modula':
INSTALL Run this script each time you wish to try Turbo.
The script assumes you have already extracted the files in
dice/dice.lha (see above).
Type "execute INSTALL" to run the script.
You must be in this directory for it to work.
The script will make the necessary assignments and path
additions.
The INSTALL script will assign 'MODULA:' to this directory.
README This file.
EXTENSIONS A description of some of the extra features added to the
compiler (language extensions).
DISCLAIMLER Please read this file before using any of the programs.
M2OPTS Default M2OPTS file (see below).
examples/ Some example programs.
src/ Source code for amiga interface, ANSI C and PIM definition
modules.In order to save space, this demo contains only a small
selection of modules.
sym/ Symbol files for above definition modules.
obj/ Compiled object modules, mainly from the implementation modules
for the definition modules in src/. On startup these modules
normally open the required amiga libraries (intuition etc).
lib/ Contains linker libraries and support code.
bin/ Executables for M2C, M2B, M2E & M2L.
All these programs were developed using M2C, M2B, M2E & M2L :^)
All can be made resident.
They are only runable from the shell.
dice/ DICE system.If you want to redistribute DICE then you must
include all the files in the dice/dice.lha archive.
Filename extensions
===================
*.err Binary error file generated by M2C & M2B, used by M2E.
*.mod Program/implementation module (ascii text).
*.def Definition module (ascii text).
*.o Standard Amiga object file, generated by M2C from a *.mod file.
*.sym Symbol file generated by M2C from a *.def file.
*.lib Linker Library. A concatenation of *.o files.
*.lnk Linker object file list(ascii), written to the T: directory by M2L,
read by DCC.
Error Lister (M2E)
==================
If M2B or M2C encounter errors while processing a source file, then a
binary error file will be generated.
Use M2E to view the errors encoded in this file.
usage: m2e modulename
Program Builder (M2B)
=====================
M2B will take care of compilation and linking for you.It checks file
timestamps to see which files need to be (re)compiled/(re)linked.
M2B is like MAKE, but instead of using a makefile it uses import lists.
usage: m2b [-f][-v][-t] [compile/link options] filename [DCC options & args]
-f: Force all time comparisons to fail(all modules will be (re)compiled).
-v: Write out the name of each file as it is read.
-t: Don't actually call M2C & M2L just print the commands that would have
been executed.
example:
/-------- -s passed to DCC
>m2b -v -p -b -q foo.mod -s
^--^--^------------------ -p -b -q are compiler(M2C) options
-q is also an M2L option.
Assuming that foo.o is older than foo.mod and foo.mod does not import
any other module then M2B will call M2C & M2L as
m2c -p -b -q foo.mod
m2l -q foo.o -s (but only if m2c did not fail)
You may find the TOUCH program (in dice/bin/) useful when using M2B.
Compiler (M2C)
==============
usage: m2c [-D][-C][-b][-p][-w][-q][-l] {-Mdir} filename/modulename
-D: Use large data model (default is small data model).
If your program declares more than 64K of global variables then you must
enable this option for each constituent module (except library
modules that were compiled small data & -l), otherwise linking will
fail. By allocating large data structures on the heap you can easily
avoid the need to use this option.
Using the small data & code models will make your program more compact.
Compiling all modules small data will also allow a program to be
made fully resident.
-C: Use large code model.
If a module compiles to about 32000 bytes or more, then you may need to
enable this option (depending on whether linking fails).
If a module compiles to more than 32767 bytes then you definitely need
to enable this option.
-b: Enable array bounds checking.
-p: Enable pointer checking.
The compiler will insert code to check that all pointer & VAR parameter
accesses are within a specific range.At the moment the bounds are
fixed to 1K..16M.If you're Amiga has valid memory outside this range
(and you're program may access it) then you cannot use this option.
Programmers who do not have a MMU, may find this option very useful.
Pointer checking should only be used during program development.
Depending on programming style (access procedures or open structures),
pointer checking may or may not massively increase the size of a program
It does not slow down a program by as much as you may expect.
-w: Disable compiler warnings.
-q: Be quiet.
-l: (equivalent to the DICE option -S)
Name BSS(global variable space) section libbss instead of just 'bss'.
Use this option to compile re-usable modules that do not have much BSS.
This will enable you to use small code library modules with (large code)
program modules that declare a lot of BSS.This option avoids the need to
have two different versions (one small & one large) of said modules.
-M: Add dir to the symbol file directory search path.
If a dir/sym/ subdirectory exists, it will be added instead.
It is possible to set/clear some of these options inside a source text
by using comments, however this method is not described here.
If a Modula-2 run-time error occurs (illegal case index, halt called,
array/pointer checking etc) the run time support code (in M2.lib) will
display a requester with the first 4 letters of the module name and (full)
line number of where the error occurred.
¥ou can use dice/dobj to view the machine code generated by the compiler.
One pass compilation
--------------------
The compiler operates in a single pass, this means that you must declare
variables & procedures before you use them.The compiler provides the FORWARD
keyword in order to allow early declarations for procedures that are
implemented later.
PROCEDURE f( ) ; FORWARD ; (* implementation must be in the same scope *)
PROCEDURE g( ) ;
BEGIN f( ) ;
END g ;
PROCEDURE f( ) ; (* alternatively we could nest f( ) inside g( ) *)
BEGIN g( )
END f ;
If a procedure is declared in a definition module then a forward declaration
in the corresponding implementation module is never required.
Type sizes & extremal values
----------------------------
size (bytes) range
============ =====
SHORTCARD 1 0 .. 255
CARDINAL 2 0 .. 65535
SHORTINT 1 -128 .. 127
INTEGER 2 -32768 .. 32767
LONGINT 4 -(2^31) .. (2^31)-1
SHORTREAL 4 Motorola FFP
REAL 4 IEEE single precision
LONGREAL 8 IEEE double precision
There is also a LONGCARD datatype which is declared as a
LONGINT[0..MAX(LONGINT)].
Linker frontend (M2L)
=====================
M2L calls DCC (which in turn calls DLINK) to link the object modules
generated by the compiler into an executable file. M2L is itself normally
called by M2B (M2B->M2L->DCC->DLINK).
Usage: m2l [-q] {-Mdir} module[.o] [DCC options & args]
-q : Quiet, don't print the path of each file as it is read.
-Mdir : Add directory dir to the object file search path.
If a dir/obj/ subdirectory exists, it will be added instead.
module: Program (root) module name.
This object module must be in a local directory
Anything on the command line that follows the module name is passed to DCC.
example: m2l -q foo -s -r
^--^-- passed to dcc.
This will invoke DCC:
dcc -LMODULA:lib @t:foo.lnk -s -r -ofoo
Where t:foo.lnk (intermediate file generated by M2L) will contain:
m2_main.o
foo.o
m2.lib
m2_main.o m2.lib are normally in directory MODULA:lib
M2OPTS
======
An optional ascii text file named M2OPTS in the MODULA: directory can
specify M2C and M2L command line options.
M2L filters M2OPTS looking for -q & -M's ignoring all other options.
Options in M2OPTS are scanned before command line options.
An M2OPTS text in your source directory will override the one in MODULA: .
Ordering the full version
=========================
If you would like the full version of Amiga Turbo Modula-2, which can only
be ordered from me:
Mr A S Mann
1 Blossom Way,
West Drayton,
Middlesex,
England (UK),
UB7-9HF.
At the very reasonable price of 25 pounds sterling or 40 US dollars.
This is inclusive of postage, disks etc and at least 1 update.
I can only accept cheques from a UK bank, Royal Mail postal order(crossed),
Eurocheck, or an International money order that is redeemable in the UK.
UK mainland users can try sending cash, but this is not recomended.
International orders should never include cash.
Please print your name & address clearly.
-- Thankyou for trying Turbo, the best Amiga Modula-2 compiler available!